#!/usr/bin/python
# -*- coding:utf-8 -*-
# @FileName : dp_test2_1.py
# Author    : myh

# encoding:gbk
import numpy as np
import torch
import matplotlib.pyplot as plt
import os

os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'

def f(x):
    return x**3 - 1/x


x = np.arange(0, 3, 0.1)


f2=plt.figure('F2')
plt.title('f2')
plt.xlabel('x')
plt.ylabel('y')
plot1,=plt.plot(x, f(x) ,color='red',linestyle='-',label='1')
plot2,=plt.plot(x, 4 * x - 4  ,color='blue',linestyle='--',label='2')
f2.legend([plot1, plot2],['f(x)','x=1,QieXian'])
f2.show()
